package org.blueoxygen.kukuruyuk.actions.item;
import java.util.ArrayList;
import java.util.List;

import org.blueoxygen.cimande.gx.entity.GxDroplistValue;
import org.blueoxygen.cimande.persistence.PersistenceAware;
import org.blueoxygen.cimande.persistence.PersistenceManager;
import org.blueoxygen.cimande.persistence.hibernate.HibernateSessionFactory;
import org.blueoxygen.cimande.persistence.hibernate.HibernateSessionFactoryAware;
import org.blueoxygen.kukuruyuk.actions.RoleKukuruyukAction;
import org.blueoxygen.kukuruyuk.entity.Item;
import org.blueoxygen.kukuruyuk.entity.Supplier;

public class ItemForm extends RoleKukuruyukAction {
		
	private HibernateSessionFactory hsf;
	
	private Supplier supplier = new Supplier();
	
	
	private GxDroplistValue droplistValue = new GxDroplistValue();
	private List<GxDroplistValue> droplistValues = new ArrayList<GxDroplistValue>();
	
	private Item item = new Item();
	private List<Item> items = new ArrayList<Item>();
	
	public String execute(){
	if(getItem().getId() != null &&
	!"".equalsIgnoreCase(getItem().getId().trim())){
	setItem((Item) manager.getById(Item.class, getItem().getId()));
	}
	setDroplistValues(manager.getList("SELECT w FROM "+GxDroplistValue.class.getName()+" w WHERE w.name.id='8a8a8a951f5fb364011f5fb4432d0001'", null, null));
	return SUCCESS;
	
	}

	public Supplier getSupplier() {
		return supplier;
	}

	public void setSupplier(Supplier supplier) {
		this.supplier = supplier;
	}

	public GxDroplistValue getDroplistValue() {
		return droplistValue;
	}

	public void setDroplistValue(GxDroplistValue droplistValue) {
		this.droplistValue = droplistValue;
	}

	public List<GxDroplistValue> getDroplistValues() {
		return droplistValues;
	}

	public void setDroplistValues(List<GxDroplistValue> droplistValues) {
		this.droplistValues = droplistValues;
	}

	public Item getItem() {
		return item;
	}

	public void setItem(Item item) {
		this.item = item;
	}

	public List<Item> getItems() {
		return items;
	}

	public void setItems(List<Item> items) {
		this.items = items;
	}
		
}
